<?php
/**
 * Created by PhpStorm.
 * User: chenzhitao
 * Date: 2018/4/7
 * Time: 下午2:46
 */

namespace App\Models;


use Illuminate\Database\Eloquent\Model;

class Company extends Model
{
    protected $table = "t_company";
    public function subcategorys()
    {
        return $this->belongsToMany(SecQualifyCategory::class,'t_categorycompany',"company_id","category_id");
    }

    public function setPicturesAttribute($pictures)
    {
        if (is_array($pictures)) {
            $this->attributes['pictures'] = json_encode($pictures);
        }
    }

    public function getPicturesAttribute($pictures)
    {
        return json_decode($pictures, true);
    }

}